import React, { useRef } from 'react'
import { Modal, Form, Input } from 'antd'
import PropTypes from 'prop-types'
const { Item } = Form
const { TextArea } = Input
function Main ({ visible, hide, decideHandle }) {
  const ref = useRef(null)
  return (
    <Modal title='审核不通过' open={visible} onOk={() => ref.current.submit()} onCancel={hide} destroyOnClose maskClosable={false}>
      <Form ref={ref} onFinish={d => decideHandle(d)}>
        <Item name='remark' label='审核意见' rules={[{ required: true, message: '审核意见不能为空' }]}>
          <TextArea rows={3} />
        </Item>
      </Form>
    </Modal>
  )
}

Main.propTypes = {
  visible: PropTypes.bool,
  hide: PropTypes.func,
  decideHandle: PropTypes.func
}

Main.defaultProps = {
  visible: false,
  hide: () => {},
  decideHandle: () => {}
}

export default Main
